<?php

namespace app\index\controller;

use app\common\model\Member;
use app\common\model\MemberFinance;
use app\common\model\MemberPackages;
use app\common\model\Packages;
use app\common\model\UcenterMember;
use think\Db;
use app\common\model\Traders as tradersModel;
use app\common\api\controller\Bonus;
use app\common\api\controller\User as UserApi;
use app\common\api\controller\Error;
use think\Validate;


class Traders extends Home
{

    protected $beforeActionList = [
        'check_load'
    ];

    /**
     * 券商列表
     */
    public function tradersLists()
    {
        $uid = $this->uid;
        $page = input('page');
        $start = ($page - 1) * self::$totalList;

        $lists = tradersModel::where('status', 1)
            ->where('uid', '<>', $uid)
            ->order('total_num desc')
            ->limit($start, self::$totalList)
            ->select();

        $totalCount = tradersModel::where('status', 1)
            ->where('uid', '<>', $uid)
            ->count();

        if ($totalCount > 0) {
            foreach ($lists as $v) {
                $v->avatar = $v->avatar > 0 ? get_cover($v->avatar, 'path') : '';
            }
        }

        $this->apiSuccess('市商列表', ['list' => $lists, 'totalCount' => $totalCount]);
    }
}